package com.itheima.ui;

import com.itheima.service.AccountService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * ClassName:Client
 * Package:com.itheima.ui
 * Description:模拟一个表现层，用于调用业务层
 * Date:2020/2/18 23:38
 * User: snow
 */
public class Client {

	public static void main(String[] args) {
		// 1、初始化Spring容器，加载配置文件
		ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
		// 2、根据id获取bean对象
		AccountService accountService = (AccountService) applicationContext.getBean("accountService");
		// AccountDao accountDao = applicationContext.getBean("accountDao", AccountDao.class);

		System.out.println(accountService);
		accountService.saveAccount();
		//关闭容器
		applicationContext.close();
	}
}
